﻿using System;
using System.Collections.Generic;
using System.Text;

namespace NFinal.Sql.Like
{
    /// <summary>
    /// 切牌操作
    /// </summary>
    public class CutCardUtil
    {
        public static int Encode(int n, int point, int index)
        {
            if (index > point)
            {
                return index - point-1;
            }
            else
            {
                return index +  (n-point-1);
            }
        }

        public static int Decode(int n, int point, int index)
        {
            if (index < (n - 1 - point))
            {
                return index + point + 1;
            }
            else
            {
                return index - (n - point-1);
            }
        }
    }
}
